<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
        /* 可以设置不同的进入和离开动画 */
    /* 设置持续时间和动画函数 */
    .slide-fade-enter-active {
      transition: all .3s ease;
    }
    .slide-fade-leave-active {
      transition: all .8s cubic-bezier(1.0, 0.5, 0.8, 1.0);
    }
    /* 进入前enter： 是右移10px;然后恢复到0的状态；离开是0的状态，最后到右移10px； */
    .slide-fade-enter, .slide-fade-leave-to 
    /* .slide-fade-leave-active for below version 2.1.8 */ {
      transform: translateX(10px);
      opacity: 0;
    }
  </style>
  <script src="../../dist/vue.min.js"></script>
  <link href="https://cdn.jsdelivr.net/npm/animate.css@3.5.1" rel="stylesheet" type="text/css">
</head>
<body>
  <div id="example-1">
    <!-- <button @click="show = !show">
      Toggle render
    </button> -->
    <!-- out-in 当前元素先进行过渡，完成之后新元素过渡进入。 -->
    <transition
      name="slide-fade"
      mode="out-in" 
    >
      <button @click="show = !show" v-if="show" key="save">
        Save
      </button>
      <button @click="show = !show" v-else key="edit">
        Edit
      </button>
    </transition>
  </div>

  <script>
    new Vue({
      el: '#example-1',
      data: {
        show: true
      }
    })
  </script>
</body>
</html>